<?php if(count($this->options) ): ?>
<div class="relative width100" id="rnkwBody">
 <span class="block width100 mlaBar">
 	<img src="http://cdn.widget.ranker.com/img/common/rnkr_widget_bar.png?v=11.4" class="block width100">
 </span> 
	<ol id="rnkwMLA" class="votable relative rows10">
	<?php $i=0; foreach($this->options as $item): 
		  $results = $item->getVoteResult($this->country->country_id);	
		  $voteHistory = $item->voteHistory($this->country->country_id);	
	?>
		<li class="block relative width100 <?php echo  ($i%2)?'alt' : ''?>" id="n_<?php echo $item->voteoption_id?>">
		 <!--  <div class="float relative rank center white rnkrDBlueBg "> 1</div> -->
		 
		  <div class="float relative votes">
		   <div class="float relative width50 center">
		    <span <?php if(!$this->disableVote):?>onClick="voteOption(<?php echo $item->voteoption_id?>, 1, this)" <?php endif;?> role="button" title="Agree" class="inlineBlock relative pointer btnVote up <?php echo ($voteHistory == 2)? 'off': (($voteHistory == 1)? 'on':'');?>" id="v_<?php echo $item->voteoption_id?>_up">
		     <span class="float icon liked grey imgText">Up</span>
		    </span>
		    <span class="block votesNum grey" id="v_<?php echo $item->voteoption_id?>_up_c"> <?php echo ($results->total_like)?$results->total_like:'0'?></span>
		   </div>
		   <div class="float relative width50 center">
		    <span <?php if(!$this->disableVote):?>onClick="voteOption(<?php echo $item->voteoption_id?>, 0, this)"<?php endif;?> role="button" title="Disagree" class="inlineBlock relative pointer btnVote down <?php echo ($voteHistory == 2)? 'off': (($voteHistory == 0)? 'on':'');?>" id="v_<?php echo $item->voteoption_id?>_down">
		     <span class="float icon unLiked grey imgText">Down</span>
		    </span>
		    <span class="block votesNum grey" id="v_<?php echo $item->voteoption_id?>_down_c"> <?php echo ($results->total_unlike)?$results->total_unlike:'0'?></span>
		   </div>
		   </div> 
		   <!--
		   <div class="float relative img"> 
		   	<a onclick="RNKR.track(['event','widget','picClick','widget:http://www.ranker.com/crowdranked-list/the-greatest-soundtracks-of-all-time | referrer:http://www.ranker.com/'])" target="_blank" href="http://www.ranker.com/pics/N6066575/grease-albums-photo-u1"> <img onerror="RNKR.img.error(this);" src="http://img3.rnkr-static.com/user_node_img/304/6066575/C50/grease-albums-photo-u1.jpg"> </a>
		   </div>
		   -->
		   <div class="relative name">
		    <span class="txt ">
		     <?php echo $item->getTitle()?>
		    </span> 
		   </div>			
		   </li>
	<?php $i++; endforeach;?>
	</ol>
</div>
<?php endif;?>
<script type="text/javascript">
function voteOption(option_id, vote, obj){

	 $$('#n_'+option_id+' .btnVote').removeClass('off');
	 $$('#n_'+option_id+' .btnVote').removeClass('on');
	 $(obj).addClass('on');

//	if($(obj).hasClass('off') || ($(obj).hasClass('up') && vote != 1) || ($(obj).hasClass('down') && vote != 0)){		 		
	    (new Request.JSON({
	      'format': 'json',
	      'url' : '<?php echo $this->url(array('module' => 'country', 'controller' => 'index', 'action' => 'vote'), 'default', true) ?>',
	      'data' : {
	        'format' : 'json',
	        'vote' : vote,
	        'country_id': <?php echo $this->country->country_id?>,
	        'option_id' : option_id        
	      },
	      'onRequest' : function(){
	
	      },
	      'onSuccess' : function(responseJSON, responseText)
	      {
	         $('v_'+option_id+'_up_c').set('html', responseJSON[0].total_like);
	         $('v_'+option_id+'_down_c').set('html', responseJSON[0].total_unlike);
	        //$('rating_text').innerHTML = responseJSON[0].total+" ratings";
	      }
	    })).send();
//	}
  }

</script>